<template>
  <div class="container">
    <div class="tips-title">1.基本用法</div>
    <el-button type="text" @click="dialogVisible1 = true">点击打开 Dialog</el-button>
    <el-dialog title="提示" :visible.sync="dialogVisible1" width="30%" :before-close="handleClose1">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible1 = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible1 = false">确 定</el-button>
      </span>
    </el-dialog>
    <div class="tips-title">2.自定义</div>
    <el-button type="text" @click="dialogTableVisible = true">打开嵌套表格的 Dialog</el-button>
    <el-dialog title="收货地址" :visible.sync="dialogTableVisible">
      <el-table :data="gridData">
        <el-table-column property="date" label="日期" width="150"></el-table-column>
        <el-table-column property="name" label="姓名" width="200"></el-table-column>
        <el-table-column property="address" label="地址"></el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>
<script>
  export default {
    name: 'o-dialog',
    data() {
      return {
        dialogVisible1: false,
        gridData: [{
          date: '2020-05-02',
          name: 'bangZZ',
          address: '广州市花都区新华街荔红南路'
        }, {
          date: '2020-05-04',
          name: 'bangZZ',
          address: '广州市花都区新华街荔红南路'
        }, {
          date: '2020-05-01',
          name: 'bangZZ',
          address: '广州市花都区新华街荔红南路'
        }, {
          date: '2020-05-03',
          name: 'bangZZ',
          address: '广州市花都区新华街荔红南路'
        }],
        dialogTableVisible: false
      }
    },
    methods: {
      handleClose1(done) {
        this.$confirm('确认关闭？')
          .then(_ => {
            done();
          })
          .catch(_ => {});
      }
    }
  }
</script>
<style>
</style>
